import { defineStore } from "pinia";
import { ref, reactive } from "vue"
import { useEnumStore } from "@/store/enumeration"
export const equityListStore = defineStore("equityListStoreId", () => {
    const { expiryPeriodType, reductionVoucherType } = useEnumStore()
    const detailData = ref([
        {
            prop: "supplierCode",
            name: "供应商编码",
            type: "text",
            value: null
        },

    ])
    const tableProp = reactive(
        {
            name: "supplierList",
            propsList: [
                {
                    prop: 'supplierCode',
                    label: '供应商编码',
                    type: 'normal',
                    minWidth: '150px',
                    hidden: true,
                },
     


                {
                    type: 'handle',
                    label: '操作',
                    width: '150px',
                    btnType: ' link',
                    slotName: 'handle',
                    hidden: true,
                }
            ]
        })
    const listSearch = reactive({
        orders: ["created_time desc"],
        condition: {

        },
        pageSize: 20,
        pageNum: 1
    });
    const pageParams = reactive({
        tableHeight: 400,
        total: 0,
        loadIng: false,
        tableData: []

    })

    const getDate1 =async (type: string) => {
        pageParams.loadIng = true
        if (type == 'reset') {
            listSearch.pageNum = 1
            listSearch.pageSize = 20
            Object.keys(listSearch.condition).forEach((it: any) => {
                if (it != 'supplierCode') {
                    // @ts-ignore
                    listSearch.condition[it] = null
                }

            })
        }

        try {
            // const res = await 
        } catch (error) {
            console.log(error);
            pageParams.loadIng = false
            
        }
    }

    return {
        detailData, tableProp, listSearch, pageParams,
        getDate1
    }
})